import pytest

@pytest.fixture(autouse=True)
def test_yield():
    print('\n前置条件一')
    yield
    print('后置条件2')


def test_01():
    print("\n这是测试用例\n")
    # yield类似unittest setupclass 和 teardown
if __name__ =="__main__":
    pytest.main(["-vs","c:/Users/origi/Documents/python/Pytest_自动化框架/yield使用方法.py"])